﻿<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default3.aspx.cs" Inherits="Default3" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title></title>
    <script src="angular.js"></script>
    <script src="controller.js"></script>

</head>
<body ng-app="myApp">
    <div ng-controller="myCtrl">
        <select ng-model="selectedName" ng-options="x for x in names">
            <option value="0">0</option>
        </select>
    </div>
    <div ng-controller="nyCtrl2">
        <select>
            <option ng-repeat="x in names">{{x}}
            </option>
        </select>
    </div>

    <div ng-controller="myCtrl3">
        <p>选择一辆车</p>
        <select ng-model="selectedCar">
                     <option ng-repeat="y in carsList">{{x.car01}}
            </option>
        </select>
        <h1>你选择的是{{selectedCar.brand}}</h1>
        <h2>模型{{selectedCar.model}}</h2>
        <h3>颜色{{selectedCar.color}}</h3>
    </div>

    <script>
        var app = angular.module("myApp", []);
        app.controller("myCtrl", function ($scope) {
            $scope.names = ["Google", "Runoob", "Taobao"];
        });


        function nyCtrl2($scope) {
            $scope.names = ["Google", "Runoob", "Taobao"];
        }
        //app.controller("nyCtrl2", function ($scope) {
        //    $scope.names = ["Google", "Runoob", "Taobao"];

        //})
        

        function myCtrl3($scope) {
            $scope.carsList = 
            { "car01": [{ "brand": "ford", "model": "mustang", "color": "red" }] };

        }
    

    </script>
</body>
</html>
